package com.xfcy.blog.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.xfcy.blog.entity.Dict;
import com.xfcy.blog.valid.AddGroup;
import com.xfcy.blog.valid.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.*;

/**
 * @author 晓风残月Lx
 * @date 2023/5/24 18:17
 */
@Data
public class DictDataDTO {

    //主键
    @Null(message = "id应该为空", groups = AddGroup.class)
    @NotNull(message = "id不能为空", groups = UpdateGroup.class)
    private Long id;

    //字典类型id
    @NotNull(message = "字典类型不能为空", groups = {UpdateGroup.class, AddGroup.class})
    private Long dictId;

    //字典标签
    @NotBlank(message = "字典标签不能为空", groups = {UpdateGroup.class, AddGroup.class})
    private String label;

    //字典键值
    @NotBlank(message = "字典键值不能为空", groups = {UpdateGroup.class, AddGroup.class})
    private String value;


    private String style;

    //是否默认（1是 0否）
    @Pattern(regexp = "^[0-1]{1}$", message = "是否默认必须为0或1")
    @NotEmpty(message = "是否默认必须提交", groups = {AddGroup.class, UpdateGroup.class})
    private String isDefault;

    //排序
    @Min(value = 0, message = "排序必须大于等于0", groups = {AddGroup.class, UpdateGroup.class})
    @Max(value = 9, message = "排序必须小于等于0", groups = {AddGroup.class, UpdateGroup.class})
    private Integer sort;

    //是否发布(1:是，0:否)
    @Pattern(regexp = "^[0-1]{1}$", message = "发布状态必须为0或1")
    @NotEmpty(message = "发布状态必须提交", groups = {AddGroup.class, UpdateGroup.class})
    private String isPublish;

    //备注
    private String remark;

}
